home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 441 / dlibs12 / sprintf.c < prev    next >
C/C++ Source or Header  |  1990-11-23  |  541b  |  34 lines

  1. #include <stdarg.h>
  2.  
  3. static unsigned int sputc(c, s)
  4.     char c, **s;
  5.     {
  6.     return(*(*s)++ = c);
  7.     }
  8.  
  9. sprintf(buf, fmt, arg)
  10.     char *buf;
  11.     char *fmt;
  12.     int arg;
  13.     {
  14.     register int n;
  15.     register char *p = buf;
  16.  
  17.     n = _printf(&buf, sputc, fmt, &arg);
  18.     p[n] = '\0';        /* always tie of the string */
  19.     return(n);
  20.     }
  21.  
  22. vsprintf(buf, fmt, args)
  23.     char *buf;
  24.     char *fmt;
  25.     va_list args;
  26.     {
  27.     register int n;
  28.     register char *p = buf;
  29.  
  30.     n = _printf(&buf, sputc, fmt, args);
  31.     p[n] = '\0';        /* always tie of the string */
  32.     return(n);
  33.     }
  34.